﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views.popups.fountain {
    import reprise.ui.*;
    import flash.events.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.models.*;
    import net.wooga.pets.constants.*;
    import net.wooga.pets.utils.*;
    import net.wooga.pets.models.fountain.*;

    public class FountainNextElderPopupMediator extends AbstractFountainPopupMediator {

        public var fountain:FountainModel;
        public var user:UserModel;

        override public function onRegister():void{
            super.onRegister();
            this.showPetsToCure();
        }
        protected function showPetsToCure():void{
            var _local2:UIComponent;
            var _local1:int = this.fountain.getNextElderIn(this.user.numberOfCuredPets);
            if (_local1){
                RepriseUtils.addComponent(_content, "elder_baby_cycle");
                addLabel("fountainSubHeader myriadProFont", "fountain_cure_amount_pets", {amount:_local1}, _content);
                addLabel("cycleLabel_1 myriadProFontNormal", "fountain_explanation_1st_step", null, _content);
                addLabel("cycleLabel_2 myriadProFontNormal", "fountain_explanation_2nd_step", null, _content);
                addLabel("cycleLabel_3 myriadProFontNormal", "fountain_explanation_3rd_step", null, _content);
                _local2 = RepriseUtils.addComponent(_content, "buttonContainer");
                this.addActionButton("global_open_computer", _local2);
                addLabel("orLabel myriadProFont", "collections_reward_or", null, _local2);
                this.addActionButton("global_button_trade_collection", _local2, this.onTradeClick);
            };
        }
        override protected function addActionButton(_arg1:String, _arg2:UIComponent=null, _arg3:Function=null):void{
            _actionButton = createButton(((_arg2) || (this.view)), "nextElderGreenButton greenButton", _arg1, "myriadProFont");
            eventMap.mapListener(_actionButton, MouseEvent.CLICK, ((_arg3) || (this.onClick)));
        }
        private function onTradeClick(_arg1:MouseEvent):void{
            close();
            dispatch(new InfoEvent(EventConstants.CREATE_POPUP, GameConstants.COLLECTION_POPUP));
        }
        protected function showReward(_arg1:String, _arg2:Object, _arg3:UIComponent=null):void{
            var _local4:int = int(_arg2[_arg1]);
            if (_local4){
                addReward(_arg1, _local4, _arg3);
                _rewardCount++;
            };
        }
        override protected function onClick(_arg1:MouseEvent):void{
            close();
            dispatch(new InfoEvent(EventConstants.SHOW_PATIENT_POOL_COMMAND));
        }
        private function get view():FountainNextElderPopupView{
            return ((viewComponent as FountainNextElderPopupView));
        }

    }
}//package net.wooga.pets.views.popups.fountain 
